package monitor

import (
	"github.com/spf13/viper"
	"log"
)

var (
	config = initConfig()
)

func initConfig() *viper.Viper {
	log.Println("start get metricConfig")
	config := viper.New()
	config.SetDefault("logging.level", "info")
	config.SetDefault("version", "")
	config.SetConfigName("metricConfig")
	config.AddConfigPath("/usr/bin/fcs-api/")
	err := config.ReadInConfig()

	if err != nil {
		log.Println("Fatal error reading config file: %s", err)
		return nil
	}
	log.Println("get metricConfig success")
	return config
}

func GetConfig() *viper.Viper {
	return config
}
